package com.gaojinqi.base.config.configuration;

import com.gaojinqi.base.core.jpa.factory.CustomRepositoryFactoryBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.web.config.EnableSpringDataWebSupport;

/**
 * Jpa 配置
 *
 * @author gaojinqi
 * @version 1.0
 * @since 2020年04月10日
 */
@Configuration
//@ConditionalOnProperty(prefix = "com.gaojinqi.jpa", name = "enabled", havingValue = "true", matchIfMissing = true)
@EnableJpaRepositories(basePackages = {"com.gaojinqi"}, excludeFilters = {
        @ComponentScan.Filter(type = FilterType.REGEX, pattern = "BaseRepository.*")},
        repositoryFactoryBeanClass = CustomRepositoryFactoryBean.class)
@EntityScan("com.gaojinqi")
@EnableSpringDataWebSupport
@EnableJpaAuditing
@Slf4j
public class JpaDataAutoConfiguration {
    public JpaDataAutoConfiguration() {
    }
}
